package com.empire.module.member.dal.mysql.internetarticle;

import java.util.*;

import com.empire.framework.common.pojo.PageResult;
import com.empire.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.empire.framework.mybatis.core.mapper.BaseMapperX;
import com.empire.module.member.dal.dataobject.internetarticle.InternetArticleDO;
import org.apache.ibatis.annotations.Mapper;
import com.empire.module.member.controller.admin.internetarticle.vo.*;

/**
 * 互联网文章 Mapper
 *
 * @author 主席大人
 */
@Mapper
public interface InternetArticleMapper extends BaseMapperX<InternetArticleDO> {

    default PageResult<InternetArticleDO> selectPage(InternetArticlePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InternetArticleDO>()
                .eqIfPresent(InternetArticleDO::getDictionaryType, reqVO.getDictionaryType())
                .eqIfPresent(InternetArticleDO::getArticleId, reqVO.getArticleId())
                .eqIfPresent(InternetArticleDO::getArticleGenUuidHashId, reqVO.getArticleGenUuidHashId())
                .eqIfPresent(InternetArticleDO::getUrl, reqVO.getUrl())
                .eqIfPresent(InternetArticleDO::getTitle, reqVO.getTitle())
                .eqIfPresent(InternetArticleDO::getTitleCn, reqVO.getTitleCn())
                .eqIfPresent(InternetArticleDO::getArticleType, reqVO.getArticleType())
                .eqIfPresent(InternetArticleDO::getContent, reqVO.getContent())
                .eqIfPresent(InternetArticleDO::getContentCn, reqVO.getContentCn())
                .betweenIfPresent(InternetArticleDO::getPublishedTime, reqVO.getPublishedTime())
                .eqIfPresent(InternetArticleDO::getLocation, reqVO.getLocation())
                .eqIfPresent(InternetArticleDO::getUserGenUuid, reqVO.getUserGenUuid())
                .eqIfPresent(InternetArticleDO::getArticleGenUuid, reqVO.getArticleGenUuid())
                .eqIfPresent(InternetArticleDO::getMediaList, reqVO.getMediaList())
                .eqIfPresent(InternetArticleDO::getPersonId, reqVO.getPersonId())
                .eqIfPresent(InternetArticleDO::getTags, reqVO.getTags())
                .orderByDesc(InternetArticleDO::getId));
    }

}